﻿<Workspace x:Name="thai_parse"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:sys="clr-namespace:System;assembly=mscorlib"
  xmlns="clr-namespace:agree;assembly=agree-sys"
  xmlns:semi="clr-namespace:agree.semi;assembly=agree-sys">

    <Workspace.DefaultDirectories>
        <StringItem>grammars</StringItem>
        <StringItem>grammars\thai</StringItem>
    </Workspace.DefaultDirectories>

    <!--<thaifuncs:thaiTokenizer x:Name="thai_tokenizer" Lexicon="{x:Reference thai_lex}"/>-->

    <XamlLoadInstance x:Name="thai_xli" Filename="configs\thai.xml" />
    
    <PathRef x:Name="thai" Item="{x:Reference thai_xli}" Path="RootElement.NameScope[thai]" />

    <PredicateIndex x:Name="thai_pred_idx"
                Loader="{PredicateIndexLoader {PathRef {x:Reference thai}, EntryMgr.Lexicon}}" />
    <!--, {x:Reference thai_dup_lex_id}-->

    <!--<XamlLoadInstance Filename="configs\thai.xml" />-->
    <!--<XamlLoadInstance x:Name="sookgasem" Filename="grammars\thai\sookgasem.xml" />-->

    <StringCorpus xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="test_sentences" >

        <Item Text="เด็ก เล็ก กิน ข้าว" ItemStatus="Grammatical" xml:lang="th">
            <Item.Translations>
                <Item xml:lang="en" Text="The small child is eating." />
            </Item.Translations>
        </Item>

        <Item Text="แมว นอน" ItemStatus="Grammatical" xml:lang="th">
            <Item.Translations>
                <Item xml:lang="en" Text="The cat is sleeping." />
            </Item.Translations>
        </Item>
	
        <Item Text="ฝน ตก" ItemStatus="Grammatical" xml:lang="th">
            <Item.Translations>
                <Item xml:lang="en" Text="It's raining." />
            </Item.Translations>
        </Item>

        <Item Text="คุณ ชอบ อยู่ เมือง ไทย ไหม" ItemStatus="Grammatical" xml:lang="th">
            <Item.Translations>
                <Item xml:lang="en" Text="Do you like living in Thailand?" />
            </Item.Translations>
        </Item>

    </StringCorpus>

    <!--<XamlLoadInstance Filename="grammars\thai\sentences-575.xml" />-->

    <StringCorpus x:Name="sentences_575" Items="{TextFileLoader grammars\\thai\\complete-sentences-spaced.txt}" />

    <Sequence x:Name="parse_th">

        <WhitespaceSplitterF />

        <Factory x:TypeArguments="OrthLexentLookup">
            <Setter Property="{x:Static P.Lexicon}" Value="{PathRef {x:Reference thai}, EntryMgr.Lexicon}" />
        </Factory>

        <Factory x:TypeArguments="FindChartobjCoverage" />

        <!--<Factory x:TypeArguments="VerifyCoverageLoader" />-->

        <!--<ChartObjLatticeExtractorF />-->

        <Factory x:TypeArguments="ParseControl">
            <Setter Property="{x:Static P.AgreeConfig}" Value="{PathRef {x:Reference thai}, AgreeConfig}" />
            <Setter Property="{x:Static P.ChartConfig}" Value="{PathRef {x:Reference thai}, AgreeConfig.Parser.Chart}" />
            <Setter Property="{x:Static P.TfsUnifier}" Value="{PathRef {x:Reference thai}, TfsUnifier}" />
            <Setter Property="{x:Static P.ChartStartSymbols}" Value="{PathRef {x:Reference thai}, EntryMgr.ParserStartSymbols}" />
            <Setter Property="{x:Static P.QuickCheck}" Value="{PathRef {x:Reference thai}, QuickCheck}" />
        </Factory>

        <Factory x:TypeArguments="UnpackLoader">
            <Setter Property="{x:Static P.TfsUnifier}" Value="{PathRef {x:Reference thai}, TfsUnifier}" />
        </Factory>

        <Factory x:TypeArguments="semi:DerivationToMrs">
            <Setter Property="{x:Static P.Vpm}" Value="{PathRef {x:Reference thai}, Vpm}"/>
        </Factory>
        
    </Sequence>


    <Sequence x:Name="gen_th">
    
        <Factory x:TypeArguments="semi:VpmReverse">
            <Setter Property="{x:Static P.Grammar}" Value="{x:Reference thai}" />
            <Setter Property="{x:Static P.Vpm}" Value="{PathRef {x:Reference thai}, Vpm}"/>
        </Factory>

        <Factory x:TypeArguments="GenerationInputMaker">
            <Setter Property="{x:Static P.MrsManager}" Value="{PathRef {x:Reference thai}, MrsManager}"/>
        </Factory>
	
        <Factory x:TypeArguments="DetermineRelevantRules">
            <Setter Property="{x:Static P.RuleSet}" Value="{PathRef {x:Reference thai}, EntryMgr.GeneratorRules}" />
            <Publisher Property="{x:Static P.GeneratorActiveRules}" />
            <!-- ('Publisher' functionality is not actually implemented yet) -->
        </Factory>

        <ForkJoin>
            <Factory x:TypeArguments="LookupPredLexicalEntries">
                <Setter Property="{x:Static P.PredicateIndex}" Value="{x:Reference thai_pred_idx}" />
            </Factory>

            <Factory x:TypeArguments="ApplyTriggerRules">
                <Setter Property="{x:Static P.TriggerRuleMgr}" Value="{PathRef {x:Reference thai_xli}, RootElement.NameScope[thai_trm]}" />
            </Factory>
        </ForkJoin>

        <Factory x:TypeArguments="GenControl">
            <Setter Property="{x:Static P.AgreeConfig}" Value="{PathRef {x:Reference thai}, AgreeConfig}" />
            <Setter Property="{x:Static P.ChartConfig}" Value="{PathRef {x:Reference thai}, AgreeConfig.Generator.Chart}" />
            <Setter Property="{x:Static P.TfsUnifier}" Value="{PathRef {x:Reference thai}, TfsUnifier}" />
            <Setter Property="{x:Static P.ChartStartSymbols}" Value="{PathRef {x:Reference thai}, EntryMgr.GeneratorStartSymbols}" />
            <Setter Property="{x:Static P.QuickCheck}" Value="{PathRef {x:Reference thai}, QuickCheck}" />
        </Factory>

        <Factory x:TypeArguments="UnpackLoader">
            <Setter Property="{x:Static P.TfsUnifier}" Value="{PathRef {x:Reference thai}, TfsUnifier}" />
        </Factory>

    </Sequence>

    <Sequence x:Name="batch_th">
        
        <!--<x:Reference Name="test_sentences" />-->
        <x:Reference Name="sentences_575" />
        <!--<x:Reference Name="sookgasem" />-->
        
        <x:Reference Name="parse_th" />
    </Sequence>

</Workspace>
